//
// Created by xiexiangping on 23-04-17
//
#ifndef AUDIOCOLLECTIONENCODE_H
#define AUDIOCOLLECTIONENCODE_H

#include "baseCollectionEncode.h"

#define OUTPUT_FILENAME "output.pcm" // 保存音频数据的文件名
#define SAMPLE_RATE 44100 // 采样率
#define CHANNELS 2 // 声道数
#define OUTPUT_FORMAT AV_SAMPLE_FMT_FLTP // 输出音频采样格式

class audioCollectionEncode : public baseCollectionEncode {
public:

    audioCollectionEncode() {
        mAudioPts = 0.0f;
    }

    ~audioCollectionEncode() {}

private:
    bool initStream();

    void read();

    //编码原始数据
    AVPacket *encodeAudioFrame(int oneChannelDataSize);

    SwrContext *swrCtx;

    AVCodecContext *codecCtx;//可能可以直接使用pCodecCtx

    AVFrame *dstFrame;

    float mAudioPts;

    AVFrame *aFrame;
};

#endif // AUDIOCOLLECTIONENCODE_H
